Skip to main content
Version: 5.2.0.1

Callback function for message type name

Concept

When a message is parsed by a serializer, it may sometimes be necessary to determine the message type based on the received data. If it is not possible to identify the message type using the predefined standard mechanism, a user-defined message lookup can be implemented. This lookup must define the message type name from the header attributes provided to the user-defined function.

Creation

Step 1: Create a new Java Source.

Step 2: Select "Callback function for message type name" as Class template.

Output filter

After the creation of the java source the following screen appears:

Output filter example

As one can see, the key function in this context is resolveMessageTypeName. Whenever a serializer or deserializer needs to dynamically infer the message type name, this function is invoked. It generates the appropriate message type name to be used for parsing the message.

note

The returned message type name must be available within the scenario. If it is not, an error will be thrown. As indicated by the function signature, several parameters are passed that can be used to generate the message type name.

The parameters are defined as follows:

  • scenarioIdentifier: A unique identifier for the owning scenario.

  • availableMessageTypes: A set containing all the message type names currently available in the scenario.

  • messageProperties: A map of key-value pairs containing pre-parsed attributes that should be used to generate the message type. Typically, this map includes the header fields of the underlying message.